//
//  LJP_SecondGuideCell.m
//  God_is_a_Girl
//
//  Created by 李继鹏 on 15/10/5.
//  Copyright (c) 2015年 呸. All rights reserved.
//

#import "LJP_SecondGuideCell.h"
#import "LJP_GuideCellModel.h"
@implementation LJP_SecondGuideCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.title = [[UILabel alloc] init];
        self.player = [[UILabel alloc] init];
        self.duration = [[UILabel alloc] init];
        self.comments = [[UILabel alloc] init];
        self.player.font = [UIFont systemFontOfSize:13];
        self.duration.font = [UIFont systemFontOfSize:13];
        self.comments.font = [UIFont systemFontOfSize:13];
        self.title.font = [UIFont systemFontOfSize:16];
        [self.contentView addSubview:self.title];
        [self.contentView addSubview:self.duration];
        [self.contentView addSubview:self.comments];
        [self.contentView addSubview:self.player];
        self.player.textColor = [UIColor colorWithWhite:0.640 alpha:1.000];
        self.duration.textColor = [UIColor colorWithWhite:0.640 alpha:1.000];
        self.comments.textColor = [UIColor colorWithWhite:0.640 alpha:1.000];

    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.title.frame = CGRectMake(20, 10, [UIScreen mainScreen].bounds.size.width - 40, 30);
    self.player.frame = CGRectMake(20, 55, 100, 20);
    self.duration.frame = CGRectMake(150, 55, 60, 20);
    self.comments.frame = CGRectMake(230, 55, 60, 20);
}
- (void)setModel:(LJP_GuideCellModel *)model
{
    if (model != _model) {
        _model = model;
    }
    self.title.text = _model.title;
    self.player.text = [NSString stringWithFormat:@"播放:%@次", _model.playtimes];
    self.comments.text = [NSString stringWithFormat:@"评论:%@", _model.comments];
    int temp = _model.duration.intValue;
    int min = temp / 60;
    int sec = temp % 60;
    self.duration.text = [NSString stringWithFormat:@"🕑 %d:%d", min, sec];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
